<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>公共导航网站更新 - 浪海博客</title>
    <meta name="keywords" content="浪海博客,公共导航网站更新" />
    <meta name="description" content="浪海博客的公共导航网站更新页面。" />
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <link rel="stylesheet" href="/pear/component/pear/css/pear.css" />
</head>
<body>

    <form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            <div class="layui-form-item">
                <label class="layui-form-label">导航网站名字</label>
                <div class="layui-input-block">
                    <input type="text" th:value="${navWebsite.name}" name="name" lay-verify="name" autocomplete="off" placeholder="请输入导航网站名字"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">导航网站logo图片地址</label>
                <div class="layui-input-block">
                    <input type="text" th:value="${navWebsite.imageUrl}" name="imageUrl" lay-verify="imageUrl" autocomplete="off" placeholder="请输入导航网站logo图片地址"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">导航网站首页图片地址</label>
                <div class="layui-input-block">
                    <input type="text" th:value="${navWebsite.indexImageUrl}" name="indexImageUrl" lay-verify="indexImageUrl" autocomplete="off" placeholder="请输入导航网站首页图片地址"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">导航网站路径</label>
                <div class="layui-input-block">
                    <input type="text" th:value="${navWebsite.url}" name="url" lay-verify="url" autocomplete="off" placeholder="请输入导航网站路径"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">导航网站描述</label>
                <div class="layui-input-block">
                    <input type="text" th:value="${navWebsite.description}" name="description" lay-verify="description" autocomplete="off" placeholder="请输入导航网站描述"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">导航网站评分</label>
                <div class="layui-input-block">
                    <input type="text" th:value="${navWebsite.score}" name="score" lay-verify="number" autocomplete="off" placeholder="请输入导航网站评分"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">导航网站详细信息</label>
                <div class="layui-input-block">
                    <textarea th:text="${navWebsite.details}" name="details" placeholder="请输入导航网站详细信息" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="text" th:value="${navWebsite.navClassifyId}" name="navClassifyId" lay-verify="navClassifyId" autocomplete="off"
                           class="layui-hide">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="text" th:value="${navWebsite.id}" name="id" lay-verify="id" autocomplete="off"
                           class="layui-hide">
                </div>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="navWebsite-update">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

</body>
<script src="/pear/component/layui/layui.js"></script>
<script src="/pear/component/pear/pear.js"></script>
<script src="/blogs/assets/js/jquery.min.js"></script>
<script>
    layui.use(['form', 'jquery'], function() {
        let form = layui.form;
        let $ = layui.jquery;

        form.on('submit(navWebsite-update)', function(data) {
            $.ajax({
                url: "/navWebsite/updateNavWebsite",
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function(result) {
                    if (result.code == 200) {
                        layer.msg(result.message, {
                            icon: 1,
                            time: 2000
                        }, function() {
                            parent.layer.close(parent.layer.getFrameIndex(window
                                .name)); //关闭当前页
                            parent.layui.table.reload("navWebsite");
                        });
                    } else {
                        layer.msg(result.message, {
                            icon: 2,
                            time: 2000
                        });
                    }
                }
            })
            return false;
        });
    })
</script>
</html>